home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / programming / e / speedtests / bounds.e < prev    next >
Text File  |  1999-06-14  |  622b  |  29 lines

  1. OPT LARGE
  2.  
  3. MODULE '*testspeed'
  4.  
  5. CONST LOTS_OF_TIMES=1000000
  6.  
  7. DEF x,min=5,max=100
  8.  
  9. PROC main()
  10.   test({limitbounds1}, 'Limit using Bounds()', LOTS_OF_TIMES)
  11.   test({limitbounds2}, 'Limit using Bounds() and short PROC', LOTS_OF_TIMES)
  12.   test({limitif1},     'Limit using IF THEN',  LOTS_OF_TIMES)
  13.   test({limitif2},     'Limit using IF THEN and short PROC',  LOTS_OF_TIMES)
  14. ENDPROC
  15.  
  16. PROC limitif1()
  17.   IF x<min THEN x:=min
  18.   IF x>max THEN x:=max
  19. ENDPROC x
  20.  
  21. PROC limitif2() IS x:=IF x<min THEN min ELSE IF x>max THEN max ELSE x
  22.  
  23. PROC limitbounds1()
  24.   x:=Bounds(x,min,max)
  25. ENDPROC
  26.  
  27. PROC limitbounds2() IS x:=Bounds(x,min,max)
  28.  
  29.